create and install package config file
authorKevin Albertson <kevin.eric.albertson@gmail.com>
Sat, 13 Jan 2024 23:18:15 +0000 (18:18 -0500)
committerKevin Albertson <kevin.eric.albertson@gmail.com>
Mon, 15 Jan 2024 15:42:25 +0000 (10:42 -0500)
CMakeLists.txt
cmake/utf8proc-config.cmake.in [new file with mode: 0644]

index 61da950646375f52b7c3e1115568cd04af34ff69..ff94dc2d67e5b213bbb96bc67ec67081f97d0dfd 100644 (file)
@@ -66,6 +66,17 @@ if (UTF8PROC_INSTALL)
   install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libutf8proc.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
   # Install CMake targets file.
   install(EXPORT utf8proc-targets FILE utf8proc-targets.cmake DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/utf8proc" NAMESPACE utf8proc::)
+  include (CMakePackageConfigHelpers)
+  configure_package_config_file(
+      "${CMAKE_CURRENT_SOURCE_DIR}/cmake/utf8proc-config.cmake.in"
+      "${CMAKE_CURRENT_BINARY_DIR}/utf8proc-config.cmake"
+      INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/utf8proc"
+      NO_SET_AND_CHECK_MACRO
+  )
+  install (FILES
+      "${CMAKE_CURRENT_BINARY_DIR}/utf8proc-config.cmake"
+      DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/utf8proc"
+  )
 
 endif()
 
diff --git a/cmake/utf8proc-config.cmake.in b/cmake/utf8proc-config.cmake.in
new file mode 100644 (file)
index 0000000..b9149bc
--- /dev/null
@@ -0,0 +1,5 @@
+@PACKAGE_INIT@
+include("${CMAKE_CURRENT_LIST_DIR}/utf8proc-targets.cmake")
+# `check_required_components` is used to ensure consumer did not erroneously request components.
+# No components are currently defined.
+check_required_components(utf8proc)